package com.my12306.third.config;

import com.aliyun.oss.OSSClient;
import com.aliyun.oss.OSSClientBuilder;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author:苏牧夕
 * @Date:2020/5/13 23:22
 * @Version 1.0
 */
@Configuration
public class OssConfig {

    @Value("${aliyun.oss.endpoid}")
    private String endpoint;
    @Value("${aliyun.oss.bucketName}")
    private String bucket;
    @Value("${aliyun.oss.accessKeyId}")
    private String accessKeyId;// AccessKeyId。
    @Value("${aliyun.oss.accessKeySecret}")
    private String accessKeySecret;

    @Bean
    public OSSClient ossClient() {
        OSSClient ossClient = (OSSClient) new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
        return ossClient;
    }
}
